package com.optimatch.ui.view;

import java.awt.Image;
import java.awt.Toolkit;
import java.io.File;

import javax.swing.Icon;
import javax.swing.ImageIcon;

public class Icons {
	
	private static final String ICON_PATH = getIconPath();
	private static final String ICON_FILE_TYPE = ".png";
	
	private static final int ICON_SIZE = 16;
	
	public static Icon getIcon(String name) {
		Image iconImage = Toolkit.getDefaultToolkit().createImage(ICON_PATH + name + ICON_FILE_TYPE);
		iconImage.getScaledInstance(ICON_SIZE,ICON_SIZE,Image.SCALE_DEFAULT);
		Icon icon = new ImageIcon(iconImage);
		return icon;
	}

	private static String getIconPath() {
		StringBuffer buffer = new StringBuffer();
		buffer.append("pics");
		buffer.append(File.separator);
		buffer.append("icons");
		buffer.append(File.separator);
		return buffer.toString();
	}
	
}
